package com.jk.admin.controller;

import com.jk.admin.entity.TreeEntity;
import com.jk.admin.entity.User;
import com.jk.admin.service.TreeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

@Controller
public class TreeController {

    @Autowired
    private TreeService treeService;
    @RequestMapping("/")
    public  String string(){
        return "login";
    }
    /*
     * @Author 曾义才
     * @Description //TODO 查询树
     * @Date 10:29 2021/3/30
     * @Param [pid]
     * @return java.util.List<com.jk.admin.entity.TreeEntity>
     */
    @ResponseBody
    @RequestMapping("getTree")
    public List<TreeEntity> getTree(Integer pid){
        return  treeService.getTree(pid);
    }
    /*
     * @Author 曾义才
     * @Description //TODO 登录
     * @Date 10:53 2021/3/30
     * @Param [user, request]
     * @return java.util.Map
     */
    @ResponseBody
    @RequestMapping("login")
    public Map login(User user, HttpServletRequest request){
        return  treeService.login(user,request);
    }
 /*   *//*
     * @Author 曾义才
     * @Description //TODO 注册
     * @Date 19:17 2021/3/30
     * @Param [user, request]
     * @return void
     *//*
    @ResponseBody
    @RequestMapping("addUser")
    public  void string(User user,HttpServletRequest request){
        treeService.addUser(user,request);
    }*/

}
